document.write("<script language='javascript' src='config.js'></script>");

/*
 * 二次封装mui.ajax
 */
var ajaxRequest = function() {
	var own = this;
	own.data = {};
	own.domain = WEB_SERVER.domain + '/Api/';
	own.addData = function(key, value) {
		if(!value) {
			return;
		} else {
			own.data[key] = value;
		}
	}

	own.request = function(url,callback) {
//		method = method || 'GET';
		var data = {};
//      data['method']=method;
		for(var i in own.data) {
            data[i]=own.data[i]
		};
		mui.ajax(own.domain + url, {
			data: data,
			dataType: 'JSON',
			async: true,
			type: 'POST',
			timeout: 10000,
			success: function(data) {
				var result=JSON.parse(data);
				console.log(JSON.stringify(result));
				callback(result);
			},
			error: function(xhr, type, errorThrown) {
				console.log(xhr);
				callback(xhr);
			}
		})
	}
};